import { fliterPermission } from '@/utils/sys.js'
export const apis = {
  list: `/admin/basis/getList?modelCode=MODEL_GOODS&authCode=FUNCTION_GOODS_LIST`,
  del: `admin/manage/del?authCode=BTN_MANAGE_DEL`,
  add: `admin/manage/add?authCode=BTN_MANAGE_ADD`,
  edit: `admin/manage/edit?authCode=BTN_MANAGE_EDIT`,
  detail: `admin/basis/detail?modelCode=MODEL_MANAGE&authCode=BTN_MANAGE_DETAIL`,
  changePassword: `admin/manage/changePassword?modelCode=MODEL_MANAGE&authCode=BTN_MANAGE_CHANGE_PASSWORD`,
  state: `admin/manage/state?authCode=BTN_MANAGE_STATE`,
};

export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
};

export const searchs = [
  {
    type: "Input",
    column: "manage_account",
    label: "商品名称",
  },
  {
    type: "DatePicker",
    column: "ctime",
    label: "创建日期",
  },
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ],
  defaultSearchParam:[
    {
      symbol: 'gt',
      paramKey: 'role_id',
      paramValue: 0,
    }
  ]
};
export const columns = [
  { type: "selection" },
  {
    label: "商品编码",
    column: "manage_account",
  },
  {
    label: "封面",
    column: "manage_account",
  },
  {
    label: "分类",
    column: "department_id",
    display: "detail",
    format:'model',
    config: {
      mode:'custom', //'default', 默认，custom自定义方式
      component: 'department/components/Mode',
    }
  },
  {
    label: "品牌",
    column: "department_id",
    display: "detail",
    format:'model',
    config: {
      mode:'custom', //'default', 默认，custom自定义方式
      component: 'department/components/Mode',
    }
  },
  {
    label: "销量",
    column: "manage_account",
  },
  {
    label: "库存",
    column: "manage_account",
  },
  {
    label: "规格",
    column: "manage_account",
  },
  {
    label: "状态",
    column: "manage_state",
    display: "state",
    format:'dim'
  },
  {
    label: "排序",
    column: "manage_state",
    display: "state",
    format:'dim'
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime",
    display: "text",
  },
  { label: "操作", column: "operate", width: "240", fixed: "right" },
];

export const buttons = fliterPermission([
  {
    operate: "add",
    text: "新增",
    permission: 'BTN_MANAGE_DETAIL',
  },
  {
    operate: "deleteAll",
    text: "删除",
    permission: 'BTN_MANAGE_DEL',
    type: 'danger',
  },
  {
    operate: "stateOn",
    text: "启用",
    permission: 'BTN_MANAGE_STATE',
  },
  {
    operate: "stateOff",
    text: "禁用",
    permission: 'BTN_MANAGE_STATE',
  },
]);
export const columnButtons = fliterPermission([
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_MANAGE_DETAIL',
  },
  {
    operate: "edit",
    text: "编辑",
    permission: 'BTN_MANAGE_EDIT',
  },
  {
    operate: "delete",
    text: "删除",
    permission: 'BTN_MANAGE_DEL',
    type: 'danger',
  },
  {
    operate: "changePassword",
    text: "初始化密码",
    permission: 'BTN_MANAGE_CHANGE_PASSWORD',
  },
]);
